package com.hrm.service.impl;

import com.hrm.dao.HrmSalaryPayMapper;
import com.hrm.dao.HrmSalaryStandardMapper;
import com.hrm.model.HrmSalaryStandard;
import com.hrm.service.HrmPaymentService;
import com.hrm.util.PageView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("hrmPaymentService")
public class HrmPaymentServiceImpl implements HrmPaymentService{
    @Autowired
    protected HrmSalaryPayMapper hrmSalaryPayMapper;
    @Autowired
    HrmSalaryStandardMapper hrmSalaryStandardMapper;

    @Override
    public PageView findEntityPageByParam(PageView pageView, Map<String, Object> param) {
        param.put("offset", pageView.getFirstResult());
        param.put("limit", pageView.getPageSize());
        pageView.setQueryResult(hrmSalaryPayMapper.getPageNumByMap(param),
                hrmSalaryPayMapper.getPageByMap(param));
        return pageView;
    }

    @Override
    public PageView findEntityStandardPageByParam(PageView pageView, Map<String, Object> param) {
        param.put("offset", pageView.getFirstResult());
        param.put("limit", pageView.getPageSize());
        pageView.setQueryResult(hrmSalaryStandardMapper.getPageNumByMap(param),
                hrmSalaryStandardMapper.getPageByMap(param));
        return pageView;
    }

    /**
     * 查找奖惩信息
     * @param id
     * @return
     */
    @Override
    public HrmSalaryStandard getHrmReward(Integer id) {
        return hrmSalaryStandardMapper.selectByPrimaryKey(id);
    }
}
